package com.microblogforsim.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.microblogforsim.R;
import com.microblogforsim.adapter.CommentAdapter;

import java.util.ArrayList;

public class Fragment_Comment extends Fragment {
    private View view;
    private ListView lv_list;
    private ArrayList<String> data;
    private CommentAdapter adapter;
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        view = inflater.inflate(R.layout.fragment_topics_detail_comment,container,false);
        init();
        setCommentList();
        return view;
    }

    private void init() {
        lv_list = view.findViewById(R.id.fragment_comment_list);
    }

    private void setCommentList(){
        data = new ArrayList<>();
        for (int i = 0; i < 20; i++) {
            data.add("我是傻逼"+i);
        }
        adapter = new CommentAdapter(getContext(),data);
        lv_list.setAdapter(adapter);
    }

}
